/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronsicecream.pos.master.pricewarehouse;

import com.buanalintas.bynga.Field;
import com.buanalintas.bynga.Page;
import com.ronsicecream.pos.entities.PosMasterPriceWarehouse;

/**
 *
 * @author user
 */
public class Price extends Page{
    private Field priceId;
    private Field pricePrice;
    private Field pricePosUnitId;
    private Field priceItemId;
    
    private Field priceWhMkPrice;
    private Field priceWhOutletPrice;

    public Price() {
        setTheClass(PosMasterPriceWarehouse.class);

        priceId = new Field();
        priceId.setName("priceId");
        priceId.setCaption("id");
        priceId.setListProperties(" align=\"right\" width=\"5%\" nowrap");
        priceId.setInputProperties(" size=\"20\"");
        getFields().add(priceId);


        pricePosUnitId = new Field();
        pricePosUnitId.setName("pricePosUnitId");
        pricePosUnitId.setCaption("pos unit");
        pricePosUnitId.setSelectorCondition(" t.unitUnitTypeId.unitTypeId=6");
        pricePosUnitId.getSelectorColumns().add(new String[]{"unitName", " Code", "width=\"10%\" nowrap"});
        pricePosUnitId.getSelectorColumns().add(new String[]{"unitUnitTypeId", " Type", "width=\"20%\""});
        pricePosUnitId.getSelectorColumns().add(new String[]{"unitUnitId", " unit", "width=\"20%\""});
        pricePosUnitId.setSelectorOrder("t.unitName");  
        pricePosUnitId.setListProperties(" align=\"left\" width=\"80%\" nowrap");
        pricePosUnitId.setInputProperties(" size=\"30\"");
        pricePosUnitId.setRequired(true);
        pricePosUnitId.setInputCase(Field.CASE_UPPER);
        getFields().add(pricePosUnitId);
        
        priceItemId = new Field();
        priceItemId.setName("priceItemId");
        priceItemId.setCaption("item");
        priceItemId.setSelectorCondition("t.itemTypeId.typeId = 6 ");
        priceItemId.getSelectorColumns().add(new String[]{"itemCode", " Code", "width=\"10%\" nowrap"});
        priceItemId.getSelectorColumns().add(new String[]{"itemName", " Name", "width=\"20%\""});
        priceItemId.getSelectorColumns().add(new String[]{"itemMinimum", " Minimum", "width=\"20%\" nowrap"});
        priceItemId.getSelectorColumns().add(new String[]{"itemSatuanId", " Satuan", "width=\"200%\""});
        priceItemId.getSelectorColumns().add(new String[]{"itemSatuanOrder", " Satuan Order", "width=\"200%\""});
        priceItemId.getSelectorColumns().add(new String[]{"itemTypeId", " Type", "width=\"20%\""});
        priceItemId.setSelectorOrder("t.itemName"); 
        priceItemId.setListProperties(" align=\"left\" width=\"80%\" nowrap");
        priceItemId.setInputProperties(" size=\"30\"");
        priceItemId.setRequired(true);
        priceItemId.setInputCase(Field.CASE_UPPER);
        getFields().add(priceItemId);
        
        
        pricePrice = new Field();
        pricePrice.setName("pricePrice");
        pricePrice.setCaption("price buy");
        pricePrice.setListProperties(" align=\"center\" width=\"10%\" nowrap");
        pricePrice.setInputProperties(" size=\"20\"");
        pricePrice.setRequired(true);
        pricePrice.setDefaultValue(0);
        getFields().add(pricePrice);

        
        priceWhOutletPrice = new Field();
        priceWhOutletPrice.setName("priceWhOutletPrice");
        priceWhOutletPrice.setCaption("price outlet");
        priceWhOutletPrice.setListProperties(" align=\"center\" width=\"15%\" nowrap");
        priceWhOutletPrice.setInputProperties(" size=\"20\"");
        priceWhOutletPrice.setRequired(true);
        priceWhOutletPrice.setDefaultValue(0);
        getFields().add(priceWhOutletPrice);
        
        
        priceWhMkPrice = new Field();
        priceWhMkPrice.setName("priceWhMkPrice");
        priceWhMkPrice.setCaption("price mainkichen");
        priceWhMkPrice.setListProperties(" align=\"center\" width=\"15%\" nowrap");
        priceWhMkPrice.setInputProperties(" size=\"20\"");
        priceWhMkPrice.setRequired(true);
        priceWhMkPrice.setDefaultValue(0);
        getFields().add(priceWhMkPrice);

        fillFields();

//        getFieldsUnique().add(new Field[]{pricePrice});

        getFieldsAdd().remove(priceId);
        getFieldsEdit().remove(priceId);
        getFieldsList().remove(priceId);
        
        setExportList(getClass().getResourceAsStream("SatuanList.jasper"));
        setExport(getClass().getResourceAsStream("Satuan.jasper"));
//        getController().setOrder(pricePrice);
    }
}
